/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author machine
 */
@Entity
@Table(name = "peliculas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Peliculas.findAll", query = "SELECT p FROM Peliculas p"),
    @NamedQuery(name = "Peliculas.findByIdpeliculas", query = "SELECT p FROM Peliculas p WHERE p.idpeliculas = :idpeliculas"),
    @NamedQuery(name = "Peliculas.findByTitulo", query = "SELECT p FROM Peliculas p WHERE p.titulo = :titulo"),
    @NamedQuery(name = "Peliculas.findByIdentificador", query = "SELECT p FROM Peliculas p WHERE p.identificador = :identificador"),
    @NamedQuery(name = "Peliculas.findByDuracion", query = "SELECT p FROM Peliculas p WHERE p.duracion = :duracion"),
    @NamedQuery(name = "Peliculas.findByAno", query = "SELECT p FROM Peliculas p WHERE p.ano = :ano"),
    @NamedQuery(name = "Peliculas.findByUrlTrailer", query = "SELECT p FROM Peliculas p WHERE p.urlTrailer = :urlTrailer")})
public class Peliculas implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idpeliculas")
    private Collection<Personapeliculas> personapeliculasCollection;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "url_snapshot")
    private String urlSnapshot;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idpeliculas")
    private Integer idpeliculas;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "titulo")
    private String titulo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "identificador")
    private String identificador;
    @Basic(optional = false)
    @NotNull
    @Column(name = "duracion")
    private float duracion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 4)
    @Column(name = "ano")
    private String ano;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "url_trailer")
    private String urlTrailer;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "sinopsis")
    private String sinopsis;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idpeliculas")
    private Collection<Calificacion> calificacionCollection;
    @JoinColumn(name = "idcategorias", referencedColumnName = "idcategorias")
    @ManyToOne(optional = false)
    private Categorias idcategorias;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idpeliculas")
    private Collection<Coleccionpeliculas> coleccionpeliculasCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idpeliculas")
    private Collection<Alquiler> alquilerCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idpeliculas")
    private Collection<Idiomapeliculas> idiomapeliculasCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idpeliculas")
    private Collection<Seriespeliculas> seriespeliculasCollection;

    public Peliculas() {
    }

    public Peliculas(Integer idpeliculas) {
        this.idpeliculas = idpeliculas;
    }

    public Peliculas(Integer idpeliculas, String titulo, String identificador, float duracion, String ano, String urlTrailer, String sinopsis) {
        this.idpeliculas = idpeliculas;
        this.titulo = titulo;
        this.identificador = identificador;
        this.duracion = duracion;
        this.ano = ano;
        this.urlTrailer = urlTrailer;
        this.sinopsis = sinopsis;
    }

    public Integer getIdpeliculas() {
        return idpeliculas;
    }

    public void setIdpeliculas(Integer idpeliculas) {
        this.idpeliculas = idpeliculas;
    }

    public String getTitulo() {
        return titulo;
    }

    public void setTitulo(String titulo) {
        this.titulo = titulo;
    }

    public String getIdentificador() {
        return identificador;
    }

    public void setIdentificador(String identificador) {
        this.identificador = identificador;
    }

    public float getDuracion() {
        return duracion;
    }

    public void setDuracion(float duracion) {
        this.duracion = duracion;
    }

    public String getAno() {
        return ano;
    }

    public void setAno(String ano) {
        this.ano = ano;
    }

    public String getUrlTrailer() {
        return urlTrailer;
    }

    public void setUrlTrailer(String urlTrailer) {
        this.urlTrailer = urlTrailer;
    }

    public String getSinopsis() {
        return sinopsis;
    }

    public void setSinopsis(String sinopsis) {
        this.sinopsis = sinopsis;
    }

    @XmlTransient
    public Collection<Calificacion> getCalificacionCollection() {
        return calificacionCollection;
    }

    public void setCalificacionCollection(Collection<Calificacion> calificacionCollection) {
        this.calificacionCollection = calificacionCollection;
    }

    public Categorias getIdcategorias() {
        return idcategorias;
    }

    public void setIdcategorias(Categorias idcategorias) {
        this.idcategorias = idcategorias;
    }

    @XmlTransient
    public Collection<Coleccionpeliculas> getColeccionpeliculasCollection() {
        return coleccionpeliculasCollection;
    }

    public void setColeccionpeliculasCollection(Collection<Coleccionpeliculas> coleccionpeliculasCollection) {
        this.coleccionpeliculasCollection = coleccionpeliculasCollection;
    }

    @XmlTransient
    public Collection<Alquiler> getAlquilerCollection() {
        return alquilerCollection;
    }

    public void setAlquilerCollection(Collection<Alquiler> alquilerCollection) {
        this.alquilerCollection = alquilerCollection;
    }

    @XmlTransient
    public Collection<Idiomapeliculas> getIdiomapeliculasCollection() {
        return idiomapeliculasCollection;
    }

    public void setIdiomapeliculasCollection(Collection<Idiomapeliculas> idiomapeliculasCollection) {
        this.idiomapeliculasCollection = idiomapeliculasCollection;
    }

    @XmlTransient
    public Collection<Seriespeliculas> getSeriespeliculasCollection() {
        return seriespeliculasCollection;
    }

    public void setSeriespeliculasCollection(Collection<Seriespeliculas> seriespeliculasCollection) {
        this.seriespeliculasCollection = seriespeliculasCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idpeliculas != null ? idpeliculas.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Peliculas)) {
            return false;
        }
        Peliculas other = (Peliculas) object;
        if ((this.idpeliculas == null && other.idpeliculas != null) || (this.idpeliculas != null && !this.idpeliculas.equals(other.idpeliculas))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "beans.Peliculas[ idpeliculas=" + idpeliculas + " ]";
    }

    public String getUrlSnapshot() {
        return urlSnapshot;
    }

    public void setUrlSnapshot(String urlSnapshot) {
        this.urlSnapshot = urlSnapshot;
    }

    @XmlTransient
    public Collection<Personapeliculas> getPersonapeliculasCollection() {
        return personapeliculasCollection;
    }

    public void setPersonapeliculasCollection(Collection<Personapeliculas> personapeliculasCollection) {
        this.personapeliculasCollection = personapeliculasCollection;
    }
    
}
